[Haskell] Set of an Unordered Data Type with a given ordering

Posted by Ingdas on Stack Overflow See other posts from Stack Overflow or by Ingdas
Published on 2010-03-25T08:29:45Z Indexed on 2010/03/25 8:33 UTC
Read the original article Hit count: 478

Filed under:
|
|

I'm trying to put this data type in a Haskell Set, but I don't want to give it a general instance of Ord. So I want to give the set an ordering on y-coördinate but without instance Ord Vector. Is this possible?

    data Vector = V 
    { x :: Double
    , y :: Double
    } deriving (Eq)

© Stack Overflow or respective owner

Related posts about haskell

Related posts about ordering